Allow building without tests and demos
authorMatthias Clasen <mclasen@redhat.com>
Wed, 6 Sep 2017 12:33:18 +0000 (08:33 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 6 Sep 2017 13:53:20 +0000 (09:53 -0400)
This is meant to cut down build time in flatpak and similar
situations. Since it produces technically incomplete builds,
we list these options in the status output at the end of
the meson run.

docs/reference/gtk/building.sgml
meson.build
meson_options.txt

index 2f2dc1bb78bc78e62e5073f2435b8ec7e5ca1fc9..51e5d8e8f580a36a92251ac76ad1bf7543f133a0 100644 (file)
@@ -462,12 +462,12 @@ How to compile GTK+ itself
       </formalpara>
 
       <formalpara>
-        <title><systemitem>-Denable-x11-backend</systemitem>,
-          <systemitem>-Denable-win32-backend</systemitem>,
-          <systemitem>-Denable-quartz-backend</systemitem>,
-          <systemitem>-Denable-broadway-backend</systemitem>,
-          <systemitem>-Denable-wayland-backend</systemitem>, and
-          <systemitem>-Denable-mir-backend</systemitem></title>
+        <title><systemitem>enable-x11-backend</systemitem>,
+          <systemitem>enable-win32-backend</systemitem>,
+          <systemitem>enable-quartz-backend</systemitem>,
+          <systemitem>enable-broadway-backend</systemitem>,
+          <systemitem>enable-wayland-backend</systemitem>, and
+          <systemitem>enable-mir-backend</systemitem></title>
 
         <para>
           Enable specific backends for GDK.  If none of these options
@@ -480,6 +480,18 @@ How to compile GTK+ itself
         </para>
       </formalpara>
 
+      <formalpara>
+        <title><systemitem>build-tests</systemitem>
+          <systemitem>demos</systemitem></title>
+
+        <para>
+          By default, GTK+ will build quite a few tests and demos.
+          While these are useful on a developer system, they are not
+          needed when GTK+ is built e.g. for a flatpak runtime. These
+          options allow to disable building tests and demos.
+        </para>
+      </formalpara>
+
     </refsect1>
 
 </refentry>
index 995680aa900fe8eb0d79e8128e16717fabc4ccb5..85f408cb7ebb35365926198937c9ed27fa5fb394 100644 (file)
@@ -520,11 +520,15 @@ subdir('modules/input')
 subdir('gdk')
 subdir('gsk')
 subdir('gtk')
-subdir('demos')
 subdir('modules')
-subdir('tests')
-subdir('testsuite')
-subdir('examples')
+if get_option('enable-tests')
+  subdir('tests')
+  subdir('testsuite')
+endif
+if get_option('demos')
+  subdir('demos')
+  subdir('examples')
+endif
 
 # config.h
 configure_file(input: 'config.h.meson',
@@ -615,8 +619,10 @@ summary = [
   'GTK+ @0@ (@1@)'.format(gtk_version, gtk_api_version),
   '',
   '  Enabled backends: @0@'.format(pkg_targets.strip()),
-  '  Documentation: @0@'.format(get_option('enable-documentation')),
   '  Vulkan support: @0@'.format(have_vulkan),
+  '  Tests: @0@'.format(get_option('build-tests')),
+  '  Documentation: @0@'.format(get_option('enable-documentation')),
+  '  Demos: @0@'.format(get_option('demos')),
   '------',
   ''
 ]
index 586ad3e88476bf5263ccf9d13b5620e9ec3d43a4..f3b587a2122fb8c2a79bc1d6fdeb7673a15ed3b1 100644 (file)
@@ -36,3 +36,7 @@ option('enable-man-pages', type: 'boolean', value: 'false',
   description : 'Build man pages for installed tools')
 option('enable-gir', type: 'boolean', value: 'true',
   description : 'Build introspection data (requires gobject-introspection)')
+option('demos', type: 'boolean', value: 'true',
+  description : 'Build demos and example programs')
+option('build-tests', type: 'boolean', value: 'true',
+  description : 'Build tests')